feat(parser): Check if args were present #3382
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In clap2,
ArgMatches.args
was public but hidden. We made it privatein clap3, giving us more implementation flexibility but many people
relied on it, like to short-circuit defaulting, providing their own
ArgRequiredElseHelp
, etc.The main problem was how to expose this
ArgMatches
as a container (a DAG), should we have anis_empty
and what all is included in that, like subcommands?the right intent?
In the end, I realized that this aligns most with our existing
is_present
check and reporting if args are present fits the bestwithin the existing API.
I looked into also exposing iterating over the args (
present_arg_ids
)but we have no way to expose the Id. The Id is currently private and if
we made it public, it can't be used to access any arg because it can't
implement
Key
.This supersedes #3265